package com.csun.cmny.provider.device.watch.entity;

import com.csun.cmny.provider.device.phone.entity.PhoneDataEntity;
import com.csun.cmny.provider.device.watch.WatchCmdProcess;
import io.netty.channel.Channel;
import io.netty.util.AttributeKey;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-04-03 15:46
 * @Description: the class watch constant
 */
public class WatchConstant {

    /**
     * 回复 - 收到定位数据
     */
    public static final String WATCH_CODE_002 = "002";
    /**
     * 回复 - 收到开机数据
     */
    public static final String WATCH_CODE_004 = "004";
    /**
     * 回复 - 告警数据
     */
    public static final String WATCH_CODE_007 = "007";
    /**
     * 设置亲情号码
     */
    public static final String WATCH_CODE_008 = "008";
    /**
     * 回复 - 收到心率/步数/睡眠数据
     */
    public static final String WATCH_CODE_013 = "013";
    /**
     * 设置心率或者GPS数据上传频率
     */
    public static final String WATCH_CODE_014 = "014";
    /**
     * 设置时间段
     */
    public static final String WATCH_CODE_016 = "016";
    /**
     * 设置逻辑开关
     */
    public static final String WATCH_CODE_018 = "018";
    /**
     * 设置白名单类别
     */
    public static final String WATCH_CODE_020 = "020";
    /**
     * 设置音量
     */
    public static final String WATCH_CODE_026 = "026";
    /**
     * 初始化配置
     */
    public static final String WATCH_CODE_042 = "042";
    /**
     * 分包下发铃声
     */
    public static final String WATCH_CODE_044 = "044";
    /**
     * 设置闹钟
     */
    public static final String WATCH_CODE_046 = "046";
    /**
     * 设置时区
     */
    public static final String WATCH_CODE_049 = "049";

    /**
     * 是否需要发送
     */
    public static final int IS_NEED = 1;

    /**
     * 是否已经发送
     */
    public static final int IS_SEND = 1;

    /**
     * 孝心手环激活状态 -- 激活
     */
    public static final int WATCH_ACTIVATION_ON = 1;

    /**
     * 孝心手环激活状态 -- 未激活
     */
    public static final int WATCH_ACTIVATION_OFF = 0;

    /**
     * 孝心手环数据包--头
     */
    public static final String WATCH_TITLE = "@B#@";

    /**
     * 孝心手环数据包--尾
     */
    public static final String WATCH_END = "@E#@";

    /**
     * 存储 deviceNo -- channel
     *
     * @key     String  deviceNo
     * @value   Channel channel
     *
     */
    public static ConcurrentHashMap<String, Channel> WATCH_CHANNEL_MAP = new ConcurrentHashMap<>();

    /**
     * 存储 taskId -- WatchCmdProcess
     *
     * @key     String          taskId
     * @value   WatchCmdProcess watchCmdProcess
     */
    public static ConcurrentHashMap<String, WatchCmdProcess> WATCH_CMD_PROCESS_MAP = new ConcurrentHashMap<>();

    /**
     * netty channel attribute key -- watch
     */
    public static final AttributeKey<WatchDataEntity> WATCH_CHANNEL_KEY = AttributeKey.valueOf("cmny:device:xx:watch");

    /**
     * 重发次数
     */
    public static final int WATCH_INTERVAL_FREQUENCY = 10;

    /**
     * 重发间隔时间
     */
    public static final long WATCH_INTERVAL_TIME = 10 * 1000l;

    /**
     * 离线命令
     */
    public static final int WATCH_OFF_CMD = 0;

    /**
     * 非离线命令
     */
    public static final int WATCH_ON_CMD = 1;

    /**
     * 孝心手环配置 - 间隔时间设置 - 心率间隔
     */
    public static final int WATCH_CONF_RATE_TYPE_HEART = 1;
    /**
     * 孝心手环配置 - 间隔时间设置 - GPS间隔
     */
    public static final int WATCH_CONF_RATE_TYPE_GPS = 2;

    /**
     * 孝心手环配置 - 逻辑开关 - GPS开关
     */
    public static final int WATCH_CONF_SWITCH_GPS = 1;
    /**
     * 孝心手环配置 - 逻辑开关 - 白名单开关
     */
    public static final int WATCH_CONF_SWITCH_WHITE = 2;
    /**
     * 孝心手环配置 - 逻辑开关 - 黄键短信开关
     */
    public static final int WATCH_CONF_SWITCH_YELLOW = 3;
    /**
     * 孝心手环配置 - 逻辑开关 - 红键短信开关
     */
    public static final int WATCH_CONF_SWITCH_RED = 4;

    /**
     * 孝心手环配置 - 时间段 - GPS静默
     */
    public static final int WATCH_CONF_PERIOD_GPS = 1;
    /**
     * 孝心手环配置 - 逻辑开关 - 余额不足
     */
    public static final int WATCH_CONF_PERIOD_BALANCE = 2;
    /**
     * 孝心手环配置 - 逻辑开关 - 低电量
     */
    public static final int WATCH_CONF_PERIOD_POWER = 3;
}
